package cn.wolfcode.luowowo.job;

import cn.wolfcode.luowowo.cache.service.IStrategyStatisService;
import cn.wolfcode.luowowo.cache.vo.StrategyStatisVO;
import cn.wolfcode.luowowo.service.IStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RedisDataJob {

    @Autowired
    private IStrategyStatisService strategyStatisService;

    @Autowired
    private IStrategyService strategyService;


    @Scheduled(cron = "0/300 * * * * ? ")
    public void play(){
        List<StrategyStatisVO> list =  strategyStatisService.queryStatisVobyKeys("*");

        for (StrategyStatisVO vo : list) {
            strategyService.updateStrategy(vo);
        }


        System.out.println("开始持久化");
    }


}
